package com.vpx.server.controller.system;

import com.vpx.server.framework.authority.AuthPoicy;
import com.vpx.server.framework.authority.RequestAuth;
import com.vpx.server.bean.order.base.BaseDeleteOrder;
import com.vpx.server.framework.base.ResultMsg;
import com.vpx.server.service.system.SysMenuOperateService;
import com.vpx.server.bean.order.base.BaseIdOrder;
import com.vpx.server.bean.order.system.SysMenuOperateOrder;
import com.vpx.server.bean.order.system.SysMenuOperatePageOrder;
import com.vpx.server.bean.result.base.BaseDeleteResult;
import com.vpx.server.bean.result.system.SysMenuOperatePageResult;
import com.vpx.server.bean.result.system.SysMenuOperateResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author liuks
 * @title: vpx
 * @module 菜单操作
 * @description: 菜单操作接口
 * @date 2021/9/9
 */
@RestController
@RequestMapping(value = "/api/menuOperate")
@Api(tags = "基础设置-菜单操作管理")
public class SysMenuOperateController {

    @Autowired
    private SysMenuOperateService sysMenuOperateService;

    @PostMapping("insert")
    @ApiOperation("新增菜单操作")
    @RequestAuth(poicy = AuthPoicy.AUTH)
    public ResultMsg insert(@RequestBody SysMenuOperateOrder order) {
        return sysMenuOperateService.insert(order);
    }

    @DeleteMapping("deleteById")
    @ApiOperation("删除菜单操作")
    @RequestAuth(poicy = AuthPoicy.AUTH)
    public ResultMsg deleteById(@RequestBody BaseDeleteOrder order) {
        return sysMenuOperateService.deleteById(order);
    }

    @PutMapping("updateById")
    @ApiOperation("修改菜单操作")
    @RequestAuth(poicy = AuthPoicy.AUTH)
    public ResultMsg updateById(@RequestBody SysMenuOperateOrder order) {
        return sysMenuOperateService.updateById(order);
    }

    @GetMapping("findById")
    @ApiOperation("查询菜单操作")
    @RequestAuth(poicy = AuthPoicy.AUTH)
    public ResultMsg<SysMenuOperateResult> findById(BaseIdOrder order) {
        return sysMenuOperateService.findById(order);
    }

    @GetMapping("pageQuery")
    @ApiOperation("分页查询菜单操作列表")
    @RequestAuth(poicy = AuthPoicy.AUTH)
    public ResultMsg<SysMenuOperatePageResult> pageQuer(SysMenuOperatePageOrder order) {
        return sysMenuOperateService.pageQuery(order);
    }
}
